$(function(){
	//初始化日期控件
  	$('#bt, #et').datetimepicker({
  		language: 'zh-CN',
	    format: 'yyyy-mm-dd',
	    autoclose: true,
	    minuteStep: 1,
	    minView: "month"
	});


});

//加载玩家点控记录数据
function loadDatas(s){
	
	if(s=="search"){
		$("#page").val("");
	}

	//页码
	var page = $("#page").val();
	//一页显示的条数
	var pageSize = 40;
	//用户推广号
	var gm = $("#gm").val();
	//用户推广号
	var gameId = $("#gameId").val();
	//开始时间
	var begin = $("#begin_time").val();
	//结束时间
	var end = $("#end_time").val();
	//输赢状态
	var shuYing = $("#shuYing").val();
	
	$.ajax({
		type: "post",
		data: {"page":page, "pageSize":pageSize, "begin":begin, "end":end, "gm":gm, "gameId":gameId, "shuYing":shuYing},
		url: "playerDianKongList",
		beforeSend: function(){
			$("#load").css("display","block");
		},
		success: function(msg){
			$("#load").css("display","none");
			//return
			//玩家输赢总金币
			$("#allWin").html(msg.winScore);
			$("#allLose").html(msg.loseScore);
			
			//表格数据
			var datas = msg.records;
			var html = "";
			if(datas.length == 0){
				html += "<tr><td colspan='9' align='center'>没查询到符合条件的数据~</td></tr>";
			}else{
				for(var i = 0; i<datas.length; i++){
					html += "<tr>";
					html += "<td><a style='color:blue' href='playerDetailsInfo?gameId="+datas[i].GameID+"' title='查看玩家详情'>"+datas[i].GameID+"</a></td>";//推广号
					html += "<td><a style='color:blue' href='playerDetailsInfo?gameId="+datas[i].GameID+"' title='查看玩家详情'>"+datas[i].NickName+"</a></td>";//昵称
					html += "<td style='color:red;'>"+datas[i].username+"</td>";//管理员
					html += "<td>"+datas[i].writedate+"</td>";//点控时间
					var LtotalScore = datas[i].LtotalScore;//输赢
					if(LtotalScore > 0 ){
						html += "<td style='color:red;'>"+LtotalScore+"</td>";
					}else{
						html += "<td>"+LtotalScore+"</td>";
					}
					html += "<td>"+datas[i].oldlCheatLimit+"</td>";//旧作弊率
					html += "<td>"+datas[i].newlCheatRate+"</td>";//新作弊率
					html += "<td>"+datas[i].newlCheatLimit+"</td>";//点控分数
					html += "<td>"+datas[i].memo+"</td>";//说明
					html += "</tr>";
				}
			}
			$("#databody").html(html);
			
			//分页数据
			var pageInfos = msg.pageInfo;


			//总条数
			var allCount = msg.pageinfo.count
			//console.log(allCount);
			$("#count").html(allCount);
			//总页数
			var allPage = Math.ceil(allCount/pageSize);
			if(allPage==0){
				allPage = 1;
			}
			//当前页码
			var now = msg.pageinfo.page;


			$("#page").val(now);
			$("#nowPage").html(now);
			$("#allPage").html(allPage);
			$("#pageIpu").val("");
		}
	});
}